package ms.maplestory.boot.enums.login;

import java.util.Arrays;

/**
 * 检查PIN密码操作码
 */
public enum CheckPinCodeType {

    Accepted(0),
    Create(1),
    Fail(2),
    Error(3),
    Request(4),
    Unknown(7);

    private byte opcode;

    CheckPinCodeType(int opcode) {
        this.opcode = (byte) opcode;
    }

    public byte getOpcode() {
        return opcode;
    }

    public static CheckPinCodeType getByOpcode(int opcode) {
        return Arrays.stream(values()).filter(p -> p.getOpcode() == opcode).findFirst().orElse(Unknown);
    }
}
